﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Wicresoft.Common;
using Wicresoft.Framework.Organization;
using JDEduTrain.Framework.Business;
using JDEduTrain.Framework.Entity;


public partial class Page_EditOrderInfo : BaseAuthenticationPage
{
    private Guid ClassID
    {
        get
        {
            if (Request["ClassID"] != null)
            {
                return new Guid(Request["ClassID"]);

            }
            return Guid.Empty;
        }
    }
    private Guid OrderID
    {
        get
        {
            if (Request["OrderID"] != null)
            {
                return new Guid(Request["OrderID"]);

            }
            return Guid.Empty;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            BindOrder();
        }
    }

    protected void BindOrder()
    {
        if (ClassID != Guid.Empty && OrderID != Guid.Empty)
        {

            ClassOrder order = new ClassOrder(OrderID, ClassID);
            if (order.Load())
            {

                tbOrderInfo.Text = order.OrderInfo;
                tbOrderName.Text = order.OrderName;
            }
            this.Title = "编辑班次信息";
        }

    }

    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        if (ClassID != Guid.Empty && OrderID != Guid.Empty)
        {

            ClassOrder order = new ClassOrder(OrderID, ClassID);
            if (order.Load())
            {

                order.OrderName = tbOrderName.Text;
                order.OrderInfo = tbOrderInfo.Text;
                order.Save();
            }
        }
        string script = "<script>alert('保存成功!');refreshParent();window.close();</script>";
        ClientScript.RegisterStartupScript(this.GetType(), "Close", script);
    }

}
